Repository navigation
fix: request offline_access scope for refresh tokens, centralize hosting scopes - #85
Merged
Merged
Conversation
…ing scopes cli-engine already implements refresh-token storage and silent refresh, but the CLI never requested the offline_access scope our auth platform requires to receive one, so every expired token forced a full browser re-login. Also folds the Node.js Hosting scope constants into the central scopes.rs registry so they're covered by its uniqueness/well-formedness test.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the CLI’s OAuth scope handling to ensure refresh tokens are issued (via offline_access) and consolidates Node.js Hosting scopes into the central scope registry so they’re validated and managed in one place.
Changes:
- Add
offline_accessas a default login scope to enable refresh token issuance and silent refresh. - Move Node.js Hosting OAuth scope constants into
rust/src/scopes.rsasHOSTING_*entries and update hosting code to use them. - Remove the now-redundant
hosting/nodejs/scopes.rsmodule and update docs to reflect the centralized scope registry.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| rust/src/scopes.rs | Adds OFFLINE_ACCESS and centralizes Node.js Hosting scopes into the main registry. |
| rust/src/hosting/nodejs/scopes.rs | Removes the per-module hosting scope constants (now centralized). |
| rust/src/hosting/nodejs/mod.rs | Switches hosting commands to use centralized HOSTING_* scope constants. |
| rust/src/environments/mod.rs | Updates default login scopes to include offline_access (but currently drops APP_REGISTRY_READ). |
| CLAUDE.md | Updates source-layout docs to point to the centralized scopes registry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes the cicd rustfmt check that failed on PR #85.
application list/info call ctx.credential() with no scope step-up, so they depend entirely on the login-default scope set. It had been dropped from DEFAULT_OAUTH_SCOPES, which would break both commands with an insufficient-scope error after a fresh login.
ALL's docstring claimed to be the complete set of scopes requiring OAuth client registration, but OFFLINE_ACCESS is deliberately excluded from it while still needing registration. Spell that out so a future sync of client registration from ALL doesn't miss it.
The module doc still described ALL as the complete/authoritative set of scopes needing OAuth client registration, contradicting the note added on OFFLINE_ACCESS/ALL itself. Align both: ALL is resource:action permission scopes only; directive scopes need registration too but live outside declare_scopes!/ALL.
jbrooks2-godaddy
approved these changes
Jul 8, 2026
This was referenced Aug 12, 2026
This was referenced Aug 19, 2026
This was referenced Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
offline_accessscope by default at login so the authorization server actually issues arefresh_token— cli-engine already implements refresh-token storage and silent refresh (PkceAuthProvider), but without this scope every expired access token forced a full interactive browser re-login.hosting/nodejs/scopes.rs) into the centralrust/src/scopes.rsregistry asHOSTING_*constants, so they're covered by the registry's uniqueness/well-formedness test and there's a single source of truth for every scope the CLI requests.Test plan
cargo buildcargo test scopes(well-formedness test passes, now covers hosting scopes too)cargo clippy -- -D warningsoffline_access, then rungddy auth login, complete the flow, and confirm a refresh token is now stored and used silently once the access token expires